# 前端构建
FROM node:21.5.0 AS frontend
COPY ./ /app
WORKDIR /app
RUN npm config set registry https://registry.npmmirror.com && \
    npm install --legacy-peer-deps
RUN npm run build

# Nginx 配置
FROM nginx:1.21.0-alpine

COPY --from=frontend app/dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/nginx.conf

WORKDIR /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"]